//
// Created by 123 on 2025/1/6.
//
#include "string"
#include "cpp108_MyArray.hpp"

void printIntArray(MyArray<int>& arr){
    for (int i = 0; i < arr.getSize(); i++) {
        cout << arr[i] << " ";
    }
    cout << endl;
}

void test1(){
    MyArray<int> arr1(10);
    for (int i = 0; i < 10; i++) {
        arr1.pushBack(i);
    }
    cout << "arr1 print input.." << endl;
    printIntArray(arr1);
    cout << "arr1 size=" << arr1.getSize() << endl;
    cout << "arr1 capacity=" << arr1.getCapacity() << endl;
    cout << "---------------------------------------" << endl;
//    MyArray<int> arr2(arr1);

}
class Person{
public:
    string name;
    int age;
public:
    Person(){

    }
    Person(string name,int age){
        this->name = name;
        this->age = age;
    }
};
void printPerson(MyArray<Person> & personArray){
    for (int i = 0; i < personArray.getSize(); ++i) {
        cout << "name:" << personArray[i].name << " age:" << personArray[i].age << endl;
    }
}

void test2(){
    MyArray<Person> perArr(10);
    Person p1("zs",11);
    Person p2("ls",22);
    Person p3("ww",33);
    Person p4("z6",44);
    perArr.pushBack(p1);
    perArr.pushBack(p2);
    perArr.pushBack(p3);
    perArr.pushBack(p4);
    printPerson(perArr);
}

int main108(){
    test1();
    test2();
    return 0;
}